package gameObject.item;

import javax.microedition.lcdui.game.LayerManager;

import gameObject.Unit;
import base.RotatableObject;

public abstract class ItemEquipment extends RotatableObject {
	protected Unit owner;
	private int id;
	public final int cost;

	final protected String name;
	public static final int ARM = 99;
	public static final int SUIT = 999;

	protected ItemEquipment(int id,String name,int cost) {
		this.id = id;
		this.name = name;
		this.cost = cost;
	}

	public void setOwner(Unit owner) {
		this.owner = owner;
		updatePosition();
	}
	public void setRotation(double r)
	{
		rotation = r;
		sprite.setRotation(r);
		//updatePositon();
	}
	public void updatePosition() {
		setPosition(owner.getX(), owner.getY());
		setRotation(owner.getRotation());
	}

	public int getId() {
		return id;
	}
	public int getItemType(){
		return 0;
	}

	public String getInfoText() {
		String info = name + " $(0)" + cost + "\n";
		return info;
	}
	public void addTo(LayerManager layer) {
		layer.insert(sprite, 2);
	}
}
